<?php
/**
 * This class check string input
 * @author phanvm
 */
App::uses('Component', 'Controller');
class StringComponent extends Component {
    /**
     * This function encode html tag
     * @author phanvm
     */
	function removeHTMLtag ($tagSource)
	{
		return htmlentities($tagSource);
		/**
		 * $searchTags = array ('@<script[^>]*?>.*?</script>@si', // Strip out javascript
		 *         '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
		 *         '@([\r\n])[\s]+@', // Strip out white space
		 *         '@&(quot|#34);@i', // Replace HTML entities
		 *         '@&(amp|#38);@i',
		 *         '@&(lt|#60);@i',
		 *         '@&(gt|#62);@i',
		 *         '@&(nbsp|#160);@i',
		 *         '@&(iexcl|#161);@i',
		 *         '@&(cent|#162);@i',
		 *         '@&(pound|#163);@i',
		 *         '@&(copy|#169);@i',
		 *         '@&#(\d+);@e'); // evaluate as php
		 *
		 *         $replaceTags = array ('',
		 *         '',
		 *         '\1',
		 *         '"',
		 *         '&',
		 *         '<',
		 *         '>',
		 *         ' ',
		 *         chr(161),
		 *         chr(162),
		 *         chr(163),
		 *         chr(169),
		 *         'chr(\1)');
		 *         return  preg_replace ($searchTags, $replaceTags, $tagSource);
		 */
	}
    /**
     * This function decode html
     * @author phanvm
     */
	function handleHTMLSpecialChars($tagSource)
	{
		return htmlspecialchars($tagSource);
	}
}
?>